/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-04-22
 * Time: 0:04
 */
public class JudgehasmanyNum {
    public static int judge(int[] arr) {
        for(int i = 0; i < arr.length; i++) {
            int count = 0;
            for(int j = 0; j < arr.length; j++) {
                if(arr[i] == arr[j]) {
                    count++;
                }
            }
            int n = (arr.length)/2;
            if(count > n) {
                return arr[i];
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        int[] arr = {2,2,1,1,1,2,2};
        int x= judge(arr);
        System.out.println(x);
    }
}
